home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
051-075
/
disk_066
/
amscsi
/
scsidvr
(
.txt
)
< prev
next >
Wrap
AmigaBASIC Source Code
|
1992-05-06
|
4KB
|
186 lines
REM SCSI adapter Test program
REM 2/27/87 Rich Frantz
REM Commands per PRIAM spec
REM +++++++++++++++++++++++++
REM EQUATES
REM +++++++++++++++++++++++++
Port0 = 8388608
Port1 = Port0 + 2
Port2 = Port0 + 4
Port3 = Port0 + 6
Port4 = Port0 + 8
Port5 = Port0 + 10
Port6 = Port0 + 12
Port7 = Port0 + 14
DIM sdata(520)
DIM rdata(520)
BLK = 1
CLI: POKE Port1,0 : REM clr SCSI bus
POKE Port3,0
IF stat > 0 THEN GOTO SENSE1:
GOSUB STATUS:
IF bsyf = 0 THEN CLI1:
PRINT "SCSI Bus BUSY"
INPUT "Retry ";q$
IF q$ = "Y" THEN CLI:
IF q$ = "R" THEN RST:
END
CLI1: INPUT "WHAT CMD (R) , (W) , (F) , (I) , (S) , (D)";q$
IF q$ = "D" THEN DRIVE:
IF q$ = "R" THEN REED:
IF q$ = "W" THEN RITE:
IF q$ = "F" THEN FORMAT:
IF q$ = "I" THEN SENSE:
IF q$ = "S" THEN GOTO ST1:
PRINT "Bad command ! ";CHR$(7)
GOTO CLI:
SENSE1: stat1 = INT(stat/16)
stat = stat - (stat1*16)
IF stat > 0 THEN SENSE:
GOTO CLI:
DRIVE: INPUT "What is the drive no. ";dr
LU = dr * 16
INPUT "What is the SCSI ID no. ";scsi
GOTO CLI:
ST1: PRINT "Sataus - "; HEX$(stat)
PRINT "Message ";
FOR x = 1 TO (rmx - 1)
PRINT " - ";HEX$(mdat(x));
NEXT x
PRINT
PRINT "RxData ";
FOR x = 1 TO (rdx - 1)
PRINT " - ";HEX$(rdata(x));
NEXT x
PRINT
GOTO CLI:
SENSE: cblk = 6
dblk = 512
mblk = 8
cmd(1) = 3 : cmd(2) = LU : cmd(3) = 0 : cmd(4) = 0 : cmd(5) = 4 : cmd(6) = 0
GOTO START:
REED: cblk = 6
dblk = 512
mblk = 6
cmd(1) = 8 : cmd(2) = LU+LBA3 : cmd(3) = LBA2 : cmd(4) = LBA1 :cmd(5) = BLK : cmd(6) = 0
INPUT "Starting address (l,m,h)";LBA1,LBA2,LBA3
GOTO START:
RITE: cblk = 6
dblk = 512
mblk = 6
cmd(1) = 10 : cmd(2) = LU+LBA3 : cmd(3) = LBA2 : cmd(4) = LBA1 : cmd(5) = BLK : cmd(6) = 0
FOR l = 1 TO 512
sdata(l) = l
NEXT l
INPUT "Starting address (l,m,h)";LBA1,LBA2,LBA3
GOTO START:
FORMAT: INPUT "THIS WILL DESTROY ALL DATA ON THE DISK ! (Y) ";q$
IF q$ = "Y" THEN FORM1:
GOTO CLI:
FORM1: cblk = 6
dblk = 512
mblk = 6
cmd(1) = 4 : cmd(2) = LU : cmd(3) = 0 : cmd(4) = 0 : cmd(5) = 0 : cmd(6) = 0
GOTO START:
RST: POKE Port1,128
GOTO CLI:
START: cx = 1 : sdx = 1 : rdx = 1 : rmx = 1
GOTO SEL:
STRT: GOSUB STATUS:
IF bsyf = 1 AND cmdf = 1 AND msgf = 0 AND inf = 0 THEN GOTO SCMD:
IF bsyf = 1 AND cmdf = 1 AND inf = 1 AND msgf = 0 THEN GOTO RDSTAT:
IF bsyf = 1 AND msgf = 1 AND cmdf = 1 AND inf = 1 THEN GOTO RMSG:
IF bsyf = 1 AND inf = 1 THEN GOTO RDAT:
IF bsyf = 1 THEN GOTO SDAT:
GOTO CLI:
REM ++++++++++++++++++++++++
REM SUBROUTINES
REM ++++++++++++++++++++++++
SEL: PRINT "Selecting dev 1 "
POKE Port0,9 :REM select target dev 0 , init = 7
POKE Port1,5
SEL1: GOSUB STATUS:
IF bsyf = 0 THEN SEL1:
GOTO STRT:
STATUS: t = PEEK(Port4+1)
t1 = PEEK(Port4+1)
IF t <> t1 THEN GOTO STATUS:
rstf = 0 : bsyf = 0 : reqf = 0 : msgf = 0 : cmdf = 0 : inf = 0 : self = 0
IF t < 128 THEN 2
t=t-128 : rstf = 1
2 IF t < 64 THEN 3
t=t-64 : bsyf = 1
3 IF t < 32 THEN 4
t=t-32 : reqf = 1
4 IF t < 16 THEN 5
t=t-16 : msgf = 1
5 IF t < 8 THEN 6
t=t-8 : cmdf = 1
6 IF t < 4 THEN 7
t=t-4 : inf = 1
7 IF t < 2 THEN 8
t=t-2 : self = 1
8 RETURN
REQACK: GOSUB STATUS:
IF reqf = 0 THEN REQACK:
PRINT ph$; bstf;msgf;cmdf;inf; "req/";
tempd = PEEK(Port0 + 1)
POKE Port1,17 : REM set ack and databus
REQ1: GOSUB STATUS:
IF reqf = 1 THEN REQ1:
PRINT "ack"
POKE Port1,1 : REM clear ack
RETURN
SCMD: POKE Port0,cmd(cx)
POKE Port3,2
ph$ = "cmd "
GOSUB REQACK:
cx = cx + 1
GOTO STRT:
SDAT: POKE Port0,sdata(sdx)
POKE Port3,1
ph$ = "snd data "
GOSUB REQACK:
sdx = sdx + 1
GOTO STRT:
RDAT: ph$ = "rx data "
POKE Port3,0
GOSUB REQACK:
rdata(rdx) = tempd
rdx = rdx + 1
GOTO STRT:
RMSG: ph$ = "rx msg "
POKE Port3,4
GOSUB REQACK:
mdat(rmx) = tempd
rmx = rmx + 1
GOTO STRT:
RDSTAT: ph$ = "status "
GOSUB REQACK:
stat = tempd
GOTO STRT: